home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / mactool / rtfimp.cpt / RTF Import 1.0a / cards.xml < prev    next >
Encoding:
Text File  |  1992-07-07  |  33.2 KB  |  301 lines

  1. card_3026.xml
  2. <?xml version="1.0" encoding="utf-8" ?>
  3. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  4. <card>
  5.     <id>3026</id>
  6.     <filler1>0</filler1>
  7.     <bitmap>BMAP_4493.pbm</bitmap>
  8.     <cantDelete> <false /> </cantDelete>
  9.     <showPict> <true /> </showPict>
  10.     <dontSearch> <false /> </dontSearch>
  11.     <owner>2719</owner>
  12.     <link rel="stylesheet" type="text/css" href="stylesheet_3212.css" />
  13.     <part>
  14.         <id>1</id>
  15.         <type>button</type>
  16.         <visible> <true /> </visible>
  17.         <reserved5> 0 </reserved5>
  18.         <reserved4> 0 </reserved4>
  19.         <reserved3> 0 </reserved3>
  20.         <reserved2> 0 </reserved2>
  21.         <reserved1> 0 </reserved1>
  22.         <enabled> <true /> </enabled>
  23.         <rect>
  24.             <left>13</left>
  25.             <top>8</top>
  26.             <right>245</right>
  27.             <bottom>67</bottom>
  28.         </rect>
  29.         <style>roundrect</style>
  30.         <showName> <true /> </showName>
  31.         <highlight> <false /> </highlight>
  32.         <autoHighlight> <true /> </autoHighlight>
  33.         <sharedHighlight> <true /> </sharedHighlight>
  34.         <family>0</family>
  35.         <titleWidth>0</titleWidth>
  36.         <icon>0</icon>
  37.         <textAlign>center</textAlign>
  38.         <font>Chicago</font>
  39.         <textSize>24</textSize>
  40.         <textStyle>outline</textStyle>
  41.         <name>RTF Import</name>
  42.         <script>on mouseUp
  43. global Dest
  44. ------------------------------------------------------------
  45. --put the name of the destination field of the RTF text
  46. --into the variable Dest
  47. ------------------------------------------------------------
  48. put "Import" into Dest
  49. ------------------------------------------------------------
  50. -- This code runs ONLY on HC 2.0 and up.
  51. -- To be cautious, we check the version of HyperCard running.
  52. if the version < 2.0 then
  53. answer "Sorry, you need HyperCard 2.0 or better." with "OK"
  54. exit mouseUp
  55. end if
  56. ------------------------------------------------------------
  57. answer file "Pick an RTF file." of type "TEXT"
  58. if it is empty then exit mouseup
  59. set the cursor to watch
  60. lock Screen
  61. put it into MyFile
  62. open file MyFile
  63. read from file MyFile until NumToChar(3) --EOF
  64. put it into FilteredText
  65. ---------------------------------------------------------
  66. --First, we separate the different bodies of the RTF file
  67. --and we generate some reference tables from them
  68. ---------------------------------------------------------
  69. --The first body is the definition with the font table
  70. ---------------------------------------------------------
  71. put char 1 to offset("}}",FilteredText) of FilteredText after Header
  72. --We find the metaCharacters
  73. repeat with MyChar = 1 to (the length of Header)
  74. set cursor to busy
  75. if (char MyChar of Header) = "{" or (char MyChar of Header) = "}"
  76. then put RETURN after HeadTbl
  77. else
  78. if (char MyChar of FilteredText) = "\"
  79. then put RETURN after HeadTbl
  80. else put char MyChar of FilteredText after HeadTbl
  81. end if
  82. end repeat
  83. --This gives us a table with items separated by returns and tabs
  84. if (word 1 of HeadTbl) Γëá"rtf1" or (word 3 of HeadTbl) Γëá"deff2"
  85. then
  86. answer "This is not a supported version of RTF file." with "OK"
  87. close file MyFile
  88. exit mouseup
  89. end if
  90. --We checked for the right type of RTF file
  91. --We can now eliminate the header and keep the font table only
  92. delete line 1 to 8 of HeadTbl
  93. repeat (the number of lines of HeadTbl)
  94. put offset(RETURN&RETURN,HeadTbl) into DblRet
  95. if DblRet Γëá 0 then
  96. delete char DblRet to (DblRet + 1) of HeadTbl
  97. put RETURN before char DblRet of HeadTbl
  98. else
  99. exit repeat
  100. end if
  101. end repeat
  102. repeat with LineNo = 1 to (the number of lines of HeadTbl div 2)
  103. delete word 1 of line (LineNo * 2) of HeadTbl
  104. delete last char of line (LineNo * 2) of HeadTbl
  105. end repeat
  106. --We eliminate the Header from the FilteredText
  107. delete char 1 to offset("}}",FilteredText) of FilteredText
  108. --
  109. ---------------------------------------------------------
  110. --The second body is the colour table
  111. --Since HC doesn't support colour yet, we simply eliminate
  112. --it from the FilteredText and ignore this body
  113. ----------------------------------------------------------
  114. delete char 1 to offset("}}",FilteredText) of FilteredText
  115. ----------------------------------------------------------
  116. --The third and fourth body are the stylesheet table
  117. --and the info sheet table.
  118. --Since supporting this feature would demand very complex
  119. --programming structures for text rarely bigger than
  120. --16 384 caracters, we decided to ignore it too
  121. --The info doesn't serve any purpose in HC, we drop it too
  122. ----------------------------------------------------------
  123. delete char 1 to offset("}}",FilteredText) of FilteredText
  124. ----------------------------------------------------------
  125. --The fifth body is the general page reference table
  126. --Since HC fields do not support layouts, we drop it too
  127. ----------------------------------------------------------
  128. delete char 1 to offset("{",FilteredText) of FilteredText
  129. ----------------------------------------------------------
  130. --Finally, the last part is the encoded text
  131. --We decode it to express all the special characters of
  132. --the Macintosh character set while giving it the right
  133. --set of Font, style and size
  134. --Note: It is imperative to remove any carriage returns
  135. --in the encoded text since it is hardcoded as "\par" anyway.
  136. ----------------------------------------------------------
  137. repeat (length(FilteredText))
  138. put offset(RETURN, FilteredText) into Spot
  139. if Spot Γëá 0 then
  140. delete char Spot of FilteredText
  141. else
  142. exit repeat
  143. end if
  144. end repeat
  145. ----------------------------------------------------------
  146. put FilteredText into cd fld Dest
  147. repeat (the length of cd fld Dest)
  148. set cursor to busy
  149. put offset("{",cd fld Dest) into LeftBraket
  150. put offset("}",cd fld Dest) into RightBraket
  151. if (LeftBraket Γëá 0) or (RightBraket Γëá 0)
  152. then
  153. if (LeftBraket Γëá 0) then
  154. delete char LeftBraket of cd fld Dest
  155. end if
  156. if (RightBraket Γëá 0) then
  157. delete char RightBraket of cd fld Dest
  158. end if
  159. else
  160. exit repeat
  161. end if
  162. end repeat
  163. ----------------------------------------------------------
  164. --INTERPRETING CHARACTERS
  165. ----------------------------------------------------------
  166. --interpreting special characters
  167. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  168. set cursor to busy
  169. put offset("\'",cd fld Dest) into MetaCharLoc
  170. put the Selection into basicString
  171. if MetaCharLoc Γëá 0 then
  172. select char MetaCharLoc to (MetaCharLoc + 3) of cd fld Dest
  173. type HandleCharacters(basicString)
  174. else
  175. exit repeat
  176. end if
  177. end repeat
  178. --interpreting carriage returns and page change
  179. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  180. set cursor to busy
  181. put offset("\par",cd fld Dest) into MetaCharLoc
  182. if MetaCharLoc Γëá 0 then
  183. select char MetaCharLoc to (MetaCharLoc + 4) of cd fld Dest
  184. type RETURN
  185. else
  186. exit repeat
  187. end if
  188. end repeat
  189. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  190. set cursor to busy
  191. put offset("\page",cd fld Dest) into MetaCharLoc
  192. if MetaCharLoc Γëá 0 then
  193. delete char MetaCharLoc to (MetaCharLoc + 5) of cd fld Dest
  194. else
  195. exit repeat
  196. end if
  197. end repeat
  198. --interpreting tabulations
  199. --Note: tabulations move the cursor from field to field, it is
  200. --not possible to enter a real tab in a field. To fix this,
  201. --we enter four spaces to simulate a tab character.
  202. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  203. set cursor to busy
  204. put offset("\tab",cd fld Dest) into MetaCharLoc
  205. if MetaCharLoc Γëá 0 then
  206. select char MetaCharLoc to (MetaCharLoc + 3) of cd fld Dest
  207. type "    "
  208. else
  209. exit repeat
  210. end if
  211. end repeat
  212. --interpreting bullets
  213. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  214. set cursor to busy
  215. put offset("\bullet",cd fld Dest) into MetaCharLoc
  216. if MetaCharLoc Γëá 0 then
  217. select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest
  218. type "ΓÇó"
  219. else
  220. exit repeat
  221. end if
  222. end repeat
  223. --interpreting emdash
  224. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  225. set cursor to busy
  226. put offset("\emdash",cd fld Dest) into MetaCharLoc
  227. if MetaCharLoc Γëá 0 then
  228. select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest
  229. type "ΓÇô"
  230. else
  231. exit repeat
  232. end if
  233. end repeat
  234. --interpreting endash
  235. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  236. set cursor to busy
  237. put offset("\endash",cd fld Dest) into MetaCharLoc
  238. if MetaCharLoc Γëá 0 then
  239. select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest
  240. type "ΓÇö"
  241. else
  242. exit repeat
  243. end if
  244. end repeat
  245. --interpreting left simple quotes
  246. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  247. set cursor to busy
  248. put offset("\lquote",cd fld Dest) into MetaCharLoc
  249. if MetaCharLoc Γëá 0 then
  250. select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest
  251. type "ΓÇÿ"
  252. else
  253. exit repeat
  254. end if
  255. end repeat
  256. --interpreting left double quotes
  257. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  258. set cursor to busy
  259. put offset("\ldblquote",cd fld Dest) into MetaCharLoc
  260. if MetaCharLoc Γëá 0 then
  261. select char MetaCharLoc to (MetaCharLoc + 10) of cd fld Dest
  262. type "ΓÇ£"
  263. else
  264. exit repeat
  265. end if
  266. end repeat
  267. --interpreting right simple quotes
  268. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  269. set cursor to busy
  270. put offset("\rquote",cd fld Dest) into MetaCharLoc
  271. if MetaCharLoc Γëá 0 then
  272. select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest
  273. type "ΓÇÖ"
  274. else
  275. exit repeat
  276. end if
  277. end repeat
  278. --interpreting right double quotes
  279. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  280. set cursor to busy
  281. put offset("\rdblquote",cd fld Dest) into MetaCharLoc
  282. if MetaCharLoc Γëá 0 then
  283. select char MetaCharLoc to (MetaCharLoc + 10) of cd fld Dest
  284. type "ΓÇ¥"
  285. else
  286. exit repeat
  287. end if
  288. end repeat
  289. --interpreting left accolade
  290. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  291. set cursor to busy
  292. put offset("\{",cd fld Dest) into MetaCharLoc
  293. if MetaCharLoc Γëá 0 then
  294. select char MetaCharLoc to (MetaCharLoc + 1) of cd fld Dest
  295. type "{"
  296. else
  297. exit repeat
  298. end if
  299. end repeat
  300. --interpreting right accolade
  301. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  302. set cursor to busy
  303. put offset("\}",cd fld Dest) into MetaCharLoc
  304. if MetaCharLoc Γëá 0 then
  305. select char MetaCharLoc to (MetaCharLoc + 1) of cd fld Dest
  306. type "}"
  307. else
  308. exit repeat
  309. end if
  310. end repeat
  311. --interpreting slash
  312. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  313. set cursor to busy
  314. put offset("\\",cd fld Dest) into MetaCharLoc
  315. if MetaCharLoc Γëá 0 then
  316. select char MetaCharLoc to (MetaCharLoc + 1) of cd fld Dest
  317. type "\"
  318. else
  319. exit repeat
  320. end if
  321. end repeat
  322. ---------------------------------------------------------------
  323. -- ELIMINATING NON-NECESSARY ENCODING
  324. ---------------------------------------------------------------
  325. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  326. set cursor to busy
  327. put offset("\qj",cd fld Dest) into MetaCharLoc
  328. if MetaCharLoc Γëá 0 then
  329. delete char MetaCharLoc to (MetaCharLoc + 2) of cd fld Dest
  330. else
  331. exit repeat
  332. end if
  333. end repeat
  334. --
  335. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  336. set cursor to busy
  337. put offset("\ril",cd fld Dest) into MetaCharLoc
  338. if MetaCharLoc Γëá 0 then
  339. delete char MetaCharLoc to (MetaCharLoc + 3) of cd fld Dest
  340. else
  341. exit repeat
  342. end if
  343. end repeat
  344. --
  345. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  346. set cursor to busy
  347. put offset("\tlul",cd fld Dest) into MetaCharLoc
  348. if MetaCharLoc Γëá 0 then
  349. delete char MetaCharLoc to (MetaCharLoc + 4) of cd fld Dest
  350. else
  351. exit repeat
  352. end if
  353. end repeat
  354. --
  355. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  356. set cursor to busy
  357. put offset("\tqr",cd fld Dest) into MetaCharLoc
  358. if MetaCharLoc Γëá 0 then
  359. delete char MetaCharLoc to (MetaCharLoc + 3) of cd fld Dest
  360. else
  361. exit repeat
  362. end if
  363. end repeat
  364. --
  365. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  366. set cursor to busy
  367. put offset("\tx",cd fld Dest) into MetaCharLoc
  368. if MetaCharLoc Γëá 0 then
  369. if char (MetaCharLoc + 6) of cd fld Dest Γëá " " or ┬¼
  370. char (MetaCharLoc + 6) of cd fld Dest Γëá "\" then
  371. delete char MetaCharLoc to (MetaCharLoc + 5) of cd fld Dest
  372. else
  373. delete char MetaCharLoc to (MetaCharLoc + 6) of cd fld Dest
  374. end if
  375. else
  376. exit repeat
  377. end if
  378. end repeat
  379. --
  380. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  381. set cursor to busy
  382. put offset("\ri1",cd fld Dest) into MetaCharLoc
  383. if MetaCharLoc Γëá 0 then
  384. if char (MetaCharLoc + 6) of cd fld Dest Γëá " " or ┬¼
  385. char (MetaCharLoc + 6) of cd fld Dest Γëá "\" then
  386. delete char MetaCharLoc to (MetaCharLoc + 6) of cd fld Dest
  387. else
  388. delete char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest
  389. end if
  390. else
  391. exit repeat
  392. end if
  393. end repeat
  394. -----------------------------------------------------------
  395. --INTERPRETING FONTS AND STYLES (SIZE,STYLE)
  396. -----------------------------------------------------------
  397. --interpreting size
  398. -----------------------------------------------------------
  399. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  400. set cursor to busy
  401. put offset("\fs",cd fld Dest) into MetaCharLoc
  402. if MetaCharLoc Γëá 0 then
  403. put (char (MetaCharLoc + 3) of cd fld Dest)&┬¼
  404. (char (MetaCharLoc + 4) of cd fld Dest) into TempSize
  405. put TempSize div 2 into MySize
  406. put MetaCharLoc into StartSize
  407. delete char MetaCharLoc to (MetaCharLoc + 4) of cd fld Dest
  408. put offset("\fs",cd fld Dest) into StopSize
  409. if StopSize = 0
  410. then
  411. set the textsize of char StartSize to ┬¼
  412. (the length of cd fld Dest) of cd fld Dest to MySize
  413. else
  414. set the textsize of char StartSize to StopSize of┬¼
  415. cd fld Dest to MySize
  416. end if
  417. else
  418. exit repeat
  419. end if
  420. end repeat
  421. ------------------------------------------------------------------
  422. -- Interpreting fonts
  423. ------------------------------------------------------------------
  424. repeat (the length of cd fld Dest div 2) -- The maximum encoded size
  425. set cursor to busy
  426. put offset("\f",cd fld Dest) into MetaCharLoc
  427. if MetaCharLoc Γëá 0 then
  428. -- We have to check the extent of the ID code (1,2,3,4 or 5 digits)
  429. if char (MetaCharLoc + 7) of cd fld Dest = " "┬¼
  430. or char (MetaCharLoc + 7) of cd fld Dest = "\"
  431. then
  432. put char (MetaCharLoc + 1) to (MetaCharLoc + 6) ┬¼
  433. of cd fld Dest into MyFontID
  434. end if
  435. if char (MetaCharLoc + 6) of cd fld Dest = " "┬¼
  436. or char (MetaCharLoc + 6) of cd fld Dest = "\"
  437. then
  438. put char (MetaCharLoc + 1) to (MetaCharLoc + 5) ┬¼
  439. of cd fld Dest into MyFontID
  440. end if
  441. if char (MetaCharLoc + 5) of cd fld Dest = " "┬¼
  442. or char (MetaCharLoc + 5) of cd fld Dest = "\"
  443. then
  444. put char (MetaCharLoc + 1) to (MetaCharLoc + 4) ┬¼
  445. of cd fld Dest into MyFontID
  446. end if
  447. if char (MetaCharLoc + 4) of cd fld Dest = " "┬¼
  448. or char (MetaCharLoc + 4) of cd fld Dest = "\"
  449. then
  450. put char (MetaCharLoc + 1) to (MetaCharLoc + 3) ┬¼
  451. of cd fld Dest into MyFontID
  452. end if
  453. if char (MetaCharLoc + 3) of cd fld Dest = " "┬¼
  454. or char (MetaCharLoc + 3) of cd fld Dest = "\"
  455. then
  456. put char (MetaCharLoc + 1) to (MetaCharLoc + 2) ┬¼
  457. of cd fld Dest into MyFontID
  458. end if
  459. put true into FontNotAvailbl
  460. repeat with LineNo = 1 to ((the number of lines of HeadTbl) div 2)
  461. if line ((LineNo * 2) - 1) of HeadTbl = MyFontID then
  462. put line (LineNo * 2) of HeadTbl into MyFont
  463. put false into FontNotAvailbl
  464. end if
  465. end repeat
  466. if FontNotAvaibl is true then
  467. answer "Font not available. Chicago used instead." with "OK"
  468. put "Chicago" into MyFont
  469. -- Note : if the Font ID is the same but the Font isn't,
  470. -- the program will not be able to set the font accordingly
  471. -- and may crash. HC cannot help us on this.
  472. end if
  473. delete char MetaCharLoc to (MetaCharLoc + length(MyFontID)) ┬¼
  474. of cd fld Dest
  475. put MetaCharLoc into StartFont
  476. put offset("\f",cd fld Dest) into StopFont
  477. if StopFont = 0
  478. then
  479. set the textFont of char StartFont to ┬¼
  480. (the length of cd fld Dest) of cd fld Dest to MyFont
  481. else
  482. set the textFont of char StartFont to StopFont of┬¼
  483. cd fld Dest to MyFont
  484. end if
  485. else
  486. exit repeat
  487. end if
  488. end repeat
  489. ------------------------------------------------------------------
  490. --interpreting style
  491. --(bold, italic, underline, outline, shadow)
  492. ------------------------------------------------------------------
  493. HandleStyles
  494. -- Note : the separate handler was used to lighten this handler.
  495. ------------------------------------------------------------------
  496. --The Filtered Text remains
  497. close file MyFile
  498. unlock Screen
  499. end mouseUp
  500.  
  501. function HandleCharacters TheString
  502. -----interpreting special characters
  503. put 1 into theStrChar
  504. if (char (theStrChar +2) of TheString)="8" then
  505. if (char (theStrChar +3) of TheString)="1" then return "├à"
  506. if (char (theStrChar +3) of TheString)="2" then return "├ç"
  507. if (char (theStrChar +3) of TheString)="3" then return "├ë"
  508. if (char (theStrChar +3) of TheString)="7" then return "├í"
  509. if (char (theStrChar +3) of TheString)="8" then return "├á"
  510. if (char (theStrChar +3) of TheString)="9" then return "├ó"
  511. if (char (theStrChar +3) of TheString)="a" then return "├ñ"
  512. if (char (theStrChar +3) of TheString)="b" then return "├ú"
  513. if (char (theStrChar +3) of TheString)="c" then return "├Ñ"
  514. if (char (theStrChar +3) of TheString)="d" then return "├º"
  515. if (char (theStrChar +3) of TheString)="e" then return "├⌐"
  516. if (char (theStrChar +3) of TheString)="f" then return "├¿"
  517. end if
  518. if (char (theStrChar +2) of TheString)="9" then
  519. if (char (theStrChar +3) of TheString)="0" then return "├¬"
  520. if (char (theStrChar +3) of TheString)="1" then return "├½"
  521. if (char (theStrChar +3) of TheString)="2" then return "├¡"
  522. if (char (theStrChar +3) of TheString)="3" then return "├¼"
  523. if (char (theStrChar +3) of TheString)="4" then return "├«"
  524. if (char (theStrChar +3) of TheString)="5" then return "├»"
  525. if (char (theStrChar +3) of TheString)="6" then return "├▒"
  526. if (char (theStrChar +3) of TheString)="7" then return "├│"
  527. if (char (theStrChar +3) of TheString)="8" then return "├▓"
  528. if (char (theStrChar +3) of TheString)="9" then return "├┤"
  529. if (char (theStrChar +3) of TheString)="a" then return "├ñ"
  530. if (char (theStrChar +3) of TheString)="b" then return "├╡"
  531. if (char (theStrChar +3) of TheString)="c" then return "├║"
  532. if (char (theStrChar +3) of TheString)="d" then return "├╣"
  533. if (char (theStrChar +3) of TheString)="e" then return "├╗"
  534. if (char (theStrChar +3) of TheString)="f" then return "├╝"
  535. end if
  536. if (char (theStrChar +2) of TheString)="a" then
  537. if (char (theStrChar +3) of TheString)="0" then return "ΓÇá"
  538. if (char (theStrChar +3) of TheString)="1" then return "┬░"
  539. if (char (theStrChar +3) of TheString)="2" then return "┬ó"
  540. if (char (theStrChar +3) of TheString)="3" then return "┬ú"
  541. if (char (theStrChar +3) of TheString)="4" then return "┬º"
  542. if (char (theStrChar +3) of TheString)="6" then return "┬╢"
  543. if (char (theStrChar +3) of TheString)="7" then return "├ƒ"
  544. if (char (theStrChar +3) of TheString)="8" then return "┬«"
  545. if (char (theStrChar +3) of TheString)="9" then return "┬⌐"
  546. if (char (theStrChar +3) of TheString)="a" then return "Γäó"
  547. if (char (theStrChar +3) of TheString)="b" then return "┬┤"
  548. if (char (theStrChar +3) of TheString)="c" then return "┬¿"
  549. if (char (theStrChar +3) of TheString)="d" then return "Γëá"
  550. if (char (theStrChar +3) of TheString)="e" then return "├å"
  551. if (char (theStrChar +3) of TheString)="f" then return "├ÿ"
  552. end if
  553. if (char (theStrChar +2) of TheString)="b" then
  554. if (char (theStrChar +3) of TheString)="0" then return "Γê₧"
  555. if (char (theStrChar +3) of TheString)="1" then return "┬▒"
  556. if (char (theStrChar +3) of TheString)="2" then return "Γëñ"
  557. if (char (theStrChar +3) of TheString)="3" then return "ΓëÑ"
  558. if (char (theStrChar +3) of TheString)="4" then return "┬Ñ"
  559. if (char (theStrChar +3) of TheString)="5" then return "┬╡"
  560. if (char (theStrChar +3) of TheString)="6" then return "Γêé"
  561. if (char (theStrChar +3) of TheString)="7" then return "Γêæ"
  562. if (char (theStrChar +3) of TheString)="8" then return "ΓêÅ"
  563. if (char (theStrChar +3) of TheString)="9" then return "╧Ç"
  564. if (char (theStrChar +3) of TheString)="a" then return "Γê½"
  565. if (char (theStrChar +3) of TheString)="b" then return "┬¬"
  566. if (char (theStrChar +3) of TheString)="c" then return "┬║"
  567. if (char (theStrChar +3) of TheString)="d" then return "╬⌐"
  568. if (char (theStrChar +3) of TheString)="e" then return "├ª"
  569. if (char (theStrChar +3) of TheString)="f" then return "├╕"
  570. end if
  571. if (char (theStrChar +2) of TheString)="c" then
  572. if (char (theStrChar +3) of TheString)="0" then return "┬┐"
  573. if (char (theStrChar +3) of TheString)="1" then return "┬í"
  574. if (char (theStrChar +3) of TheString)="2" then return "┬¼"
  575. if (char (theStrChar +3) of TheString)="3" then return "ΓêÜ"
  576. if (char (theStrChar +3) of TheString)="4" then return "╞Æ"
  577. if (char (theStrChar +3) of TheString)="5" then return "Γëê"
  578. if (char (theStrChar +3) of TheString)="6" then return "Γêå"
  579. if (char (theStrChar +3) of TheString)="7" then return "┬½"
  580. if (char (theStrChar +3) of TheString)="8" then return "┬╗"
  581. if (char (theStrChar +3) of TheString)="9" then return "ΓǪ"
  582. if (char (theStrChar +3) of TheString)="e" then return "┼Æ"
  583. if (char (theStrChar +3) of TheString)="f" then return "┼ô"
  584. end if
  585. if (char (theStrChar +2) of TheString)="d" then
  586. if (char (theStrChar +3) of TheString)="6" then return "├╖"
  587. if (char (theStrChar +3) of TheString)="7" then return "Γùè"
  588. if (char (theStrChar +3) of TheString)="8" then return "├┐"
  589. if (char (theStrChar +3) of TheString)="9" then return "┼╕"
  590. if (char (theStrChar +3) of TheString)="a" then return "/"
  591. if (char (theStrChar +3) of TheString)="b" then return "Γé¼"
  592. if (char (theStrChar +3) of TheString)="c" then return "ΓÇ╣"
  593. if (char (theStrChar +3) of TheString)="d" then return "ΓÇ║"
  594. if (char (theStrChar +3) of TheString)="f" then return "∩¼é"
  595. end if
  596. if (char (theStrChar +2) of TheString)="e" then
  597. if (char (theStrChar +3) of TheString)="0" then return "ΓÇí"
  598. if (char (theStrChar +3) of TheString)="1" then return "┬╖"
  599. if (char (theStrChar +3) of TheString)="3" then return "ΓÇ₧"
  600. if (char (theStrChar +3) of TheString)="4" then return "ΓÇ░"
  601. if (char (theStrChar +3) of TheString)="5" then return "├é"
  602. if (char (theStrChar +3) of TheString)="6" then return "├è"
  603. if (char (theStrChar +3) of TheString)="7" then return "├ü"
  604. if (char (theStrChar +3) of TheString)="8" then return "├ï"
  605. if (char (theStrChar +3) of TheString)="9" then return "├ê"
  606. if (char (theStrChar +3) of TheString)="a" then return "├ì"
  607. if (char (theStrChar +3) of TheString)="b" then return "├Ä"
  608. if (char (theStrChar +3) of TheString)="c" then return "├Å"
  609. if (char (theStrChar +3) of TheString)="d" then return "├î"
  610. if (char (theStrChar +3) of TheString)="e" then return "├ô"
  611. if (char (theStrChar +3) of TheString)="f" then return "├ö"
  612. end if
  613. if (char (theStrChar +2) of TheString)="f" then
  614. if (char (theStrChar +3) of TheString)="0" then return "∩ú┐"
  615. if (char (theStrChar +3) of TheString)="1" then return "├Æ"
  616. if (char (theStrChar +3) of TheString)="2" then return "├Ü"
  617. if (char (theStrChar +3) of TheString)="3" then return "├¢"
  618. if (char (theStrChar +3) of TheString)="4" then return "├Ö"
  619. if (char (theStrChar +3) of TheString)="5" then return "─▒"
  620. if (char (theStrChar +3) of TheString)="a" then return "╦Ö"
  621. if (char (theStrChar +3) of TheString)="b" then return "╦Ü"
  622. end if
  623. end HandleCharacters
  624.  
  625. on HandleStyles
  626. global Dest
  627. repeat (the length of cd fld Dest div 2) --The maximum encoded size
  628. set cursor to busy
  629. put offset("\b",cd fld Dest) into BoldLoc
  630. put offset("\i",cd fld Dest) into ItalicLoc
  631. put offset("\ul",cd fld Dest) into ULineLoc
  632. put offset("\outl",cd fld Dest) into OutLineLoc
  633. put offset("\shad",cd fld Dest) into ShadowLoc
  634. if (BoldLoc = 0) and (ItalicLoc = 0) and (ULineLoc = 0) and┬¼
  635. (OutLineLoc = 0) and (ShadowLoc = 0) then
  636. exit repeat
  637. else
  638. put empty into StyleList
  639. if BoldLoc = 0
  640. then put "100000," after StyleList
  641. else put BoldLoc&"," after StyleList
  642. if ItalicLoc = 0
  643. then put "100000," after StyleList
  644. else put ItalicLoc&"," after StyleList
  645. if ULineLoc = 0
  646. then put "100000," after StyleList
  647. else put ULineLoc&"," after StyleList
  648. if OutLineLoc = 0
  649. then put "100000," after StyleList
  650. else put OutLineLoc&"," after StyleList
  651. if ShadowLoc = 0
  652. then put "100000" after StyleList
  653. else put ShadowLoc after StyleList
  654. put min(StyleList) into MetaCharLoc
  655. end if
  656. --------------------------------------------------------------------
  657. -- 100000 ensures us that the absent style (0) won't be the minimum
  658. --------------------------------------------------------------------
  659. if MetaCharLoc Γëá "100000" then
  660. put empty into MyStyle
  661. repeat with PresentChar = MetaCharLoc to (length(cd fld Dest))
  662. if char PresentChar of cd fld Dest = " " ┬¼
  663. and char (PresentChar + 1) of cd fld Dest Γëá "\" then
  664. delete char MetaCharLoc to PresentChar of cd fld Dest
  665. exit repeat
  666. else
  667. put char PresentChar of cd fld Dest after MyStyle
  668. end if
  669. end repeat
  670. repeat with PresentChar = 1 to (length(MyStyle) div 2)
  671. put offset("\b",MyStyle) into BoldLoc
  672. put offset("\i",MyStyle) into ItalicLoc
  673. put offset("\ul",MyStyle) into ULineLoc
  674. put offset("\outl",MyStyle) into OutLineLoc
  675. put offset("\shad",MyStyle) into ShadowLoc
  676. if BoldLoc Γëá 0 then
  677. if char (PresentChar + 2) of MyStyle = " "
  678. then
  679. delete char PresentChar to (PresentChar + 2) of MyStyle
  680. else
  681. delete char PresentChar to (PresentChar + 1) of MyStyle
  682. end if
  683. put "bold," before char PresentChar of MyStyle
  684. end if
  685. if ItalicLoc Γëá 0 then
  686. if char (PresentChar + 2) of MyStyle = " "
  687. then
  688. delete char PresentChar to (PresentChar + 2) of MyStyle
  689. else
  690. delete char PresentChar to (PresentChar + 1) of MyStyle
  691. end if
  692. put "italic," before char PresentChar of MyStyle
  693. end if
  694. if ULineLoc Γëá 0 then
  695. if char (PresentChar + 3) of MyStyle = " "
  696. then
  697. delete char PresentChar to (PresentChar + 3) of MyStyle
  698. else
  699. delete char PresentChar to (PresentChar + 2) of MyStyle
  700. end if
  701. put "underline," before char PresentChar of MyStyle
  702. end if
  703. if OutLineLoc Γëá 0 then
  704. if char (PresentChar + 5) of MyStyle = " "
  705. then
  706. delete char PresentChar to (PresentChar + 5) of MyStyle
  707. else
  708. delete char PresentChar to (PresentChar + 4) of MyStyle
  709. end if
  710. put "outline," before char PresentChar of MyStyle
  711. end if
  712. if ShadowLoc Γëá 0 then
  713. if char (PresentChar + 5) of MyStyle = " "
  714. then
  715. delete char PresentChar to (PresentChar + 5) of MyStyle
  716. else
  717. delete char PresentChar to (PresentChar + 4) of MyStyle
  718. end if
  719. put "shadow," before char PresentChar of MyStyle
  720. end if
  721. end repeat
  722. delete last char of MyStyle
  723. put MetaCharLoc into StartStyle
  724. repeat with PresentChar = MetaCharLoc to (length(cd fld Dest))
  725. put (char PresentChar of cd fld Dest)&(char (PresentChar + 1)┬¼
  726. of cd fld Dest) into testString
  727. if testString  = "  " or testString = " "&RETURN or ┬¼
  728. testString = RETURN&RETURN then
  729. put PresentChar into StopStyle
  730. exit repeat
  731. end if
  732. end repeat
  733. if StopStyle = 0
  734. then
  735. set the textstyle of char StartStyle to ┬¼
  736. (the length of cd fld Dest) of cd fld Dest to MyStyle
  737. else
  738. set the textstyle of char StartStyle to StopStyle of┬¼
  739. cd fld Dest to MyStyle
  740. end if
  741. else
  742. exit repeat
  743. end if
  744. end repeat
  745. end HandleStyles</script>
  746.     </part>
  747.     <part>
  748.         <id>3</id>
  749.         <type>field</type>
  750.         <visible> <true /> </visible>
  751.         <dontWrap> <false /> </dontWrap>
  752.         <dontSearch> <false /> </dontSearch>
  753.         <sharedText> <false /> </sharedText>
  754.         <fixedLineHeight> <false /> </fixedLineHeight>
  755.         <autoTab> <false /> </autoTab>
  756.         <lockText> <false /> </lockText>
  757.         <rect>
  758.             <left>13</left>
  759.             <top>72</top>
  760.             <right>466</right>
  761.             <bottom>265</bottom>
  762.         </rect>
  763.         <style>scrolling</style>
  764.         <autoSelect> <false /> </autoSelect>
  765.         <showLines> <false /> </showLines>
  766.         <wideMargins> <false /> </wideMargins>
  767.         <multipleLines> <false /> </multipleLines>
  768.         <reservedFamily> 0 </reservedFamily>
  769.         <titleWidth>0</titleWidth>
  770.         <icon>0</icon>
  771.         <textAlign>left</textAlign>
  772.         <font>Times</font>
  773.         <textSize>9</textSize>
  774.         <textStyle>plain</textStyle>
  775.         <textHeight>12</textHeight>
  776.         <name>Import</name>
  777.         <script></script>
  778.     </part>
  779.     <part>
  780.         <id>5</id>
  781.         <type>button</type>
  782.         <visible> <true /> </visible>
  783.         <reserved5> 0 </reserved5>
  784.         <reserved4> 0 </reserved4>
  785.         <reserved3> 0 </reserved3>
  786.         <reserved2> 0 </reserved2>
  787.         <reserved1> 0 </reserved1>
  788.         <enabled> <true /> </enabled>
  789.         <rect>
  790.             <left>405</left>
  791.             <top>9</top>
  792.             <right>436</right>
  793.             <bottom>66</bottom>
  794.         </rect>
  795.         <style>transparent</style>
  796.         <showName> <false /> </showName>
  797.         <highlight> <false /> </highlight>
  798.         <autoHighlight> <true /> </autoHighlight>
  799.         <sharedHighlight> <true /> </sharedHighlight>
  800.         <family>0</family>
  801.         <titleWidth>0</titleWidth>
  802.         <icon>902</icon>
  803.         <textAlign>center</textAlign>
  804.         <font>Chicago</font>
  805.         <textSize>12</textSize>
  806.         <textStyle>plain</textStyle>
  807.         <name>Go</name>
  808.         <script>on mouseUp
  809. go prev card
  810. end mouseUp</script>
  811.     </part>
  812.     <part>
  813.         <id>6</id>
  814.         <type>button</type>
  815.         <visible> <true /> </visible>
  816.         <reserved5> 0 </reserved5>
  817.         <reserved4> 0 </reserved4>
  818.         <reserved3> 0 </reserved3>
  819.         <reserved2> 0 </reserved2>
  820.         <reserved1> 0 </reserved1>
  821.         <enabled> <true /> </enabled>
  822.         <rect>
  823.             <left>435</left>
  824.             <top>9</top>
  825.             <right>466</right>
  826.             <bottom>66</bottom>
  827.         </rect>
  828.         <style>transparent</style>
  829.         <showName> <false /> </showName>
  830.         <highlight> <false /> </highlight>
  831.         <autoHighlight> <true /> </autoHighlight>
  832.         <sharedHighlight> <true /> </sharedHighlight>
  833.         <family>0</family>
  834.         <titleWidth>0</titleWidth>
  835.         <icon>20098</icon>
  836.         <textAlign>center</textAlign>
  837.         <font>Chicago</font>
  838.         <textSize>12</textSize>
  839.         <textStyle>plain</textStyle>
  840.         <name>Go</name>
  841.         <script>on mouseUp
  842. go home
  843. end mouseUp</script>
  844.     </part>
  845.     <part>
  846.         <id>8</id>
  847.         <type>button</type>
  848.         <visible> <true /> </visible>
  849.         <reserved5> 0 </reserved5>
  850.         <reserved4> 0 </reserved4>
  851.         <reserved3> 0 </reserved3>
  852.         <reserved2> 0 </reserved2>
  853.         <reserved1> 0 </reserved1>
  854.         <enabled> <true /> </enabled>
  855.         <rect>
  856.             <left>246</left>
  857.             <top>34</top>
  858.             <right>280</right>
  859.             <bottom>67</bottom>
  860.         </rect>
  861.         <style>transparent</style>
  862.         <showName> <false /> </showName>
  863.         <highlight> <false /> </highlight>
  864.         <autoHighlight> <true /> </autoHighlight>
  865.         <sharedHighlight> <true /> </sharedHighlight>
  866.         <family>0</family>
  867.         <titleWidth>0</titleWidth>
  868.         <icon>14767</icon>
  869.         <textAlign>center</textAlign>
  870.         <font>Chicago</font>
  871.         <textSize>12</textSize>
  872.         <textStyle>plain</textStyle>
  873.         <name>Go</name>
  874.         <script>on mouseUp
  875. show card fld 2
  876. end mouseUp</script>
  877.     </part>
  878.     <part>
  879.         <id>9</id>
  880.         <type>field</type>
  881.         <visible> <false /> </visible>
  882.         <dontWrap> <false /> </dontWrap>
  883.         <dontSearch> <false /> </dontSearch>
  884.         <sharedText> <false /> </sharedText>
  885.         <fixedLineHeight> <false /> </fixedLineHeight>
  886.         <autoTab> <false /> </autoTab>
  887.         <lockText> <true /> </lockText>
  888.         <rect>
  889.             <left>13</left>
  890.             <top>7</top>
  891.             <right>466</right>
  892.             <bottom>68</bottom>
  893.         </rect>
  894.         <style>shadow</style>
  895.         <autoSelect> <false /> </autoSelect>
  896.         <showLines> <false /> </showLines>
  897.         <wideMargins> <true /> </wideMargins>
  898.         <multipleLines> <false /> </multipleLines>
  899.         <reservedFamily> 0 </reservedFamily>
  900.         <titleWidth>0</titleWidth>
  901.         <icon>0</icon>
  902.         <textAlign>center</textAlign>
  903.         <font>Geneva</font>
  904.         <textSize>12</textSize>
  905.         <textStyle>plain</textStyle>
  906.         <textHeight>16</textHeight>
  907.         <name></name>
  908.         <script>on mouseUp
  909. hide me
  910. end mouseUp</script>
  911.     </part>
  912.     <content>
  913.         <layer>card</layer>
  914.         <id>4</id>
  915.         <text>Yet to check:
  916. -styles
  917.  
  918.  
  919.  
  920. </text>
  921.     </content>
  922.     <content>
  923.         <layer>card</layer>
  924.         <id>9</id>
  925.         <text><span class="style40">o learn more on the process of importing Rich Text File into HyperCard 2.0, read the script of the button "RTF Import".</span><span class="style1">
  926. </span><span class="style32">-click me to remove message-</span></text>
  927.     </content>
  928.     <name></name>
  929.     <script></script>
  930. </card>
  931.  
  932.  
  933. card_4255.xml
  934. <?xml version="1.0" encoding="utf-8" ?>
  935. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  936. <card>
  937.     <id>4255</id>
  938.     <filler1>0</filler1>
  939.     <bitmap>BMAP_4699.pbm</bitmap>
  940.     <cantDelete> <false /> </cantDelete>
  941.     <showPict> <true /> </showPict>
  942.     <dontSearch> <false /> </dontSearch>
  943.     <owner>2719</owner>
  944.     <link rel="stylesheet" type="text/css" href="stylesheet_3212.css" />
  945.     <part>
  946.         <id>1</id>
  947.         <type>field</type>
  948.         <visible> <true /> </visible>
  949.         <dontWrap> <false /> </dontWrap>
  950.         <dontSearch> <false /> </dontSearch>
  951.         <sharedText> <false /> </sharedText>
  952.         <fixedLineHeight> <false /> </fixedLineHeight>
  953.         <autoTab> <false /> </autoTab>
  954.         <lockText> <true /> </lockText>
  955.         <rect>
  956.             <left>28</left>
  957.             <top>13</top>
  958.             <right>336</right>
  959.             <bottom>260</bottom>
  960.         </rect>
  961.         <style>shadow</style>
  962.         <autoSelect> <false /> </autoSelect>
  963.         <showLines> <false /> </showLines>
  964.         <wideMargins> <true /> </wideMargins>
  965.         <multipleLines> <false /> </multipleLines>
  966.         <reservedFamily> 0 </reservedFamily>
  967.         <titleWidth>0</titleWidth>
  968.         <icon>0</icon>
  969.         <textAlign>center</textAlign>
  970.         <font>Geneva</font>
  971.         <textSize>12</textSize>
  972.         <textStyle>plain</textStyle>
  973.         <textHeight>16</textHeight>
  974.         <name></name>
  975.         <script></script>
  976.     </part>
  977.     <part>
  978.         <id>2</id>
  979.         <type>button</type>
  980.         <visible> <true /> </visible>
  981.         <reserved5> 0 </reserved5>
  982.         <reserved4> 0 </reserved4>
  983.         <reserved3> 0 </reserved3>
  984.         <reserved2> 0 </reserved2>
  985.         <reserved1> 0 </reserved1>
  986.         <enabled> <true /> </enabled>
  987.         <rect>
  988.             <left>342</left>
  989.             <top>219</top>
  990.             <right>450</right>
  991.             <bottom>258</bottom>
  992.         </rect>
  993.         <style>transparent</style>
  994.         <showName> <false /> </showName>
  995.         <highlight> <false /> </highlight>
  996.         <autoHighlight> <true /> </autoHighlight>
  997.         <sharedHighlight> <true /> </sharedHighlight>
  998.         <family>0</family>
  999.         <titleWidth>0</titleWidth>
  1000.         <icon>26425</icon>
  1001.         <textAlign>center</textAlign>
  1002.         <font>Chicago</font>
  1003.         <textSize>12</textSize>
  1004.         <textStyle>plain</textStyle>
  1005.         <name>Go</name>
  1006.         <script>on mouseUp
  1007. go next card
  1008. end mouseUp</script>
  1009.     </part>
  1010.     <content>
  1011.         <layer>card</layer>
  1012.         <id>1</id>
  1013.         <text><span class="style31">TF Import </span><span class="style1">
  1014. </span><span class="style32">HyperTalk 2.0</span><span class="style33"> script for RTF importing brought to you by</span><span class="style1">
  1015. </span><span class="style34">Francis Keith Bourgoin</span><span class="style1">
  1016. </span><span class="style13">for the</span><span class="style1">
  1017. </span><span class="style37">Club Macintosh de Qu├⌐bec (CMQ) </span><span class="style1">
  1018. </span><span class="style38">the largest french Macintosh Club
  1019. in North America</span><span class="style1">
  1020. </span><span class="style13">To contact
  1021. </span><span class="style39">Keith Bourgoin</span><span class="style13">
  1022. (AOL : FKBourgoin)
  1023. (InterNet : KBourgoin@fse.ulaval.ca)
  1024. </span><span class="style39">Club Macintosh de Qu├⌐bec</span><span class="style13">
  1025. (418) 657-6916</span></text>
  1026.     </content>
  1027.     <name></name>
  1028.     <script></script>
  1029. </card>
  1030.  
  1031.  
  1032.